<?xml version="1.0" encoding="UTF-8"?>
<m:message xmlns="http://www.w3.org/1999/xhtml"
           xmlns:m="http://jboss.com/products/seam/mail"
           xmlns:h="http://java.sun.com/jsf/html"
           xmlns:rich="http://richfaces.org/rich"
           xmlns:f="http://java.sun.com/jsf/core"
           charset="UTF-8">

    <m:from name="#{currentOrder.customer.lastName} #{currentOrder.customer.firstName} #{currentOrder.customer.fatherName}" address="order@sozvezdie-store.ru" rendered="#{currentOrder.customer.email == null}" />
    <m:from name="#{currentOrder.customer.lastName} #{currentOrder.customer.firstName} #{currentOrder.customer.fatherName}" address="#{currentOrder.customer.email}" rendered="#{currentOrder.customer.email != null}" />
    <m:to>order@sozvezdie-store.ru</m:to>
    <m:subject>Заказ [#{store.domain}] для #{currentOrder.customer.lastName} #{currentOrder.customer.firstName} #{currentOrder.customer.fatherName}</m:subject>

    <m:body>
        <rich:dataTable value="#{currentOrder.lines}" var="orderLine" columnsWidth="80,250,80">
            <h:column>
                <f:facet name="header">
                    Артикул
                </f:facet>
                <h:outputText value="#{orderLine.product.SKU}"/>
            </h:column>

            <h:column>
                <f:facet name="header">
                    <h:outputText value="Наименование"/>
                </f:facet>
                <h:outputText value="#{orderLine.product.name}"/>
            </h:column>

            <h:column>
                <f:facet name="header">
                    <h:outputText value="Количество"/>
                </f:facet>
                <h:outputText value="#{orderLine.quantity}" rendered="#{orderLine.quantity > 0}"/>
            </h:column>
        </rich:dataTable>

        <p></p>

        <p>#{messages.receiver}: #{currentOrder.customer.lastName} #{currentOrder.customer.firstName} #{currentOrder.customer.fatherName}</p>
        <p>#{messages.phone}: #{currentOrder.customer.phone}</p>
        <p>#{messages.region}: #{currentOrder.customer.address.zip}, #{currentOrder.customer.address.region}, #{currentOrder.customer.address.area}, #{currentOrder.customer.address.town}</p>
        <p>#{messages.address}: #{currentOrder.customer.address.address}</p>

        <p>#{messages.deliveryType}: #{currentOrder.deliveryType.name}</p>
        <p>#{messages.paymentType}: #{currentOrder.paymentType.name}</p>

        <p>Номер заказа: #{currentOrder.id}</p>
        <p>Полная стоимость:#{" "}<h:outputText value="#{currentOrder.totalCost}">
            <f:convertNumber type="currency" currencySymbol="руб." />
        </h:outputText></p>

        <p>С уважением,<br/>Интернет-магазин #{store.name}.</p>
    </m:body>
</m:message>